#ifndef __KPF_DATACACHE_H__
#define __KPF_DATACACHE_H__

#include "typedefs.h"

#include <queue>

#include "KPF_Object.h"

template < class T >
class KPF_DataCache : public KPF_Object
{
public:
	T *get( void )
	{
		T *pRetCode = NULL;
		
		if ( m_DataQ.size(  ) > 0 )
		{
			pRetCode = m_DataQ.top();
			m_DataQ.pop(  );	
		}
		else  
		{
			pRetCode = new T(  );
			
				
		}
		
		return pRetCode;
	}
	
	bool put( const T *t )
	{
		bool bRetCode = false;
		
		bRetCode = m_DataQ.push( t );
		
		return bRetCode;
	}
	
protected:

private:
	std::queue< T * > m_DataQ;
};

#endif
